package com.ucode.springboot.starter.canal.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

import com.ucode.springboot.starter.canal.client.CanalClient;
import com.ucode.springboot.starter.canal.client.SimpleCanalClient;

import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;

public class CanalClientConfiguration {

    private static Log log = LogFactory.get();
    /**
     * canal 配置
     */
    @Autowired
    private CanalConfig canalConfig;
    
    /**
     *  canal 的客户端
     * @author liliang
     * @date 2020年2月27日
     * @return
     */
    @Bean
    private CanalClient canalClient() {
        CanalClient canalClient = new SimpleCanalClient(canalConfig);
        canalClient.start();//
        log.info("启动 canal 客户端...");
        return canalClient;
    }
}
